package modelo.servicio;

import modelo.bd.dao.AreaDAO;
import modelo.bd.excepcion.DAOException;
import modelo.dominio.Area;

public class Areas {

    private static Areas instancia;
    private AreaDAO dao;

    private Areas() {
        this.dao = new AreaDAO();
    }

    public static Areas instancia() {
        if (instancia == null) {
            instancia = new Areas();
        }
        return instancia;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return new CloneNotSupportedException("No se puede clonar Areas.");
    }
    
    public Area obtenerPorId(int idArea) throws DAOException{
        return dao.selectWhere("ID_AREA = " + idArea).get(0);
    }
}
